<%--
  Created by IntelliJ IDEA.
  User: hhx
  Date: 2025/1/13
  Time: 8:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head>
  <meta charset="UTF-8" />
  <title>商品详情</title>
  <link rel="stylesheet" href="css/style.css" type="text/css">
</head>
<body>
<!-- 判断是否登陆 -->
<c:if test="${empty user}">
  <jsp:forward page="login.jsp"></jsp:forward>
</c:if>
<div class="main">
  <h1>商品详情</h1>
  <div class="detail">
    <ul class="detail-info">
      <li style="float:left;margin-right:20px;">
        <img src="./images/${goods.goodsImg}" alt="商品图片" style="height: 320px"/>
      </li>
      <li>
        <p>商品编号：<label>${goods.itemId}</label></p>
        <p>商品名称：<label>${goods.goodsName}</label></p>
        <p>商品类型：<label>${goods.goodsType}</label></p>
        <p>商品品牌：<label>${goods.goodsBrand}</label></p>
        <p>商品单价：<label style="color: red">${goods.goodsPrice}&nbsp;元</label></p>
        <p>商品数量：<label>${goods.goodsSum}</label></p>
        <p>商品描述：<label>${goods.goodsDesc}</label></p>
        <p>商品折扣：<label style="color: red">${goods.goodsDiscount}&nbsp;折</label></p>
        <p>优惠价格：<label style="color: red"><fmt:formatNumber value="${goods.goodsPrice * goods.goodsDiscount}"
                                                                pattern="#,##0.00"/>&nbsp;元</label></p>
        <p>创建时间：<label>${goods.createDate}&nbsp;</label></p>
      </li>
    </ul>
  </div>
  <ul style="clear:both;text-align: center">
    <br/>
    <li>
      <button onclick="location.href='goodsServlet'"> &lt; 返回</button>
      <button onclick="del(${goods.id})">删除</button>
      <button onclick="location.href='goodsServlet?method=edit&id=${goods.id}'">修改</button>
    </li>
  </ul>
</div>
</body>
<script>
  function del(id) {
    if (confirm("你确定要删除吗？")) {
      window.location.href = "goodsServlet?method=delete&id=" + id;
    }
  }
</script>
</html>
